import request from "@/utils/request";
import axios from 'axios';
// const CancelToken = axios.CancelToken;
// const source = CancelToken.source();

// 获取待审核列表
export function getAllList(query) {
  return request({
    url: "/reportReview/page",
    method: "get",
    params: query,
  });
}
// 获取待审核记录列表
export function getReviewRecordPage(query) {
  return request({
    url: "/reportReview/getReviewRecordPage",
    method: "get",
    params: query,
  });
}
// 获取历史版本
export function getHisList(query) {
  return request({
    url: "/report/getHistoryReportByTaskId",
    method: "get",
    params: query,
  });
}
// 获取报告信息
export function getReport(id) {
  return request({
    url: `/report/getReportByTaskId?id=` + id,
    method: "get",
  });
}

// 上传报告信息
export function uploadReport(data) {
  return request({
    url: '/report/uploadReport',
    method: "post",
    data: data,
  });
}

// 生成报告信息
export function reportCreat(data) {
  return request({
    url: '/report/createReport',
    method: "post",
    data: data,
  });
}

// 取消生成
export function canceCreat(data) {
  return request({
    url: '/report/createReport',
    method: "post",
    data: data,
    // cancelToken: source.token
    //中止请求
    cancelToken: new axios.CancelToken(function executor(c) {
        cancel.cancel = c;
    })
  });
}
// 提交审核原因
export function saveList(data) {
  return request({
    url: '/reportReview/review',
    method: "post",
    data: data,
  });
}
// 查看任务
export function detailTask(query) {
  return request({
    url: '/preAssessTask/findById',
    method: 'get',
    params: query
  })
}